Skip to content

tests: check CoreDNS via pod state instead of host process#5366

Open
Santa0337 wants to merge 2 commits intocanonical:masterfrom
Santa0337:dhanush-contribution
Open

tests: check CoreDNS via pod state instead of host process#5366
Santa0337 wants to merge 2 commits intocanonical:masterfrom
Santa0337:dhanush-contribution

Conversation

@Santa0337
Copy link

Summary

The stop/start test was checking for a coredns host process using psutil.
In modern MicroK8s, CoreDNS runs as a containerized pod and is not visible as a
host process even when DNS is healthy. This caused the test to fail even though
CoreDNS was running correctly.

Changes

  • Added a helper to verify CoreDNS availability via Kubernetes pod state.
  • Updated the stop/start test to use Kubernetes pod status instead of checking
    for a host-level coredns process.

Testing

  • Ran pytest tests/test-simple.py locally.
  • Verified that the test now passes when CoreDNS is running as a pod.
  • Confirmed CoreDNS status using microk8s kubectl get pods -n kube-system.

Possible Regressions

This change should not introduce regressions. The test now relies on Kubernetes
API state, which is the correct and stable source of truth for CoreDNS health.

Checklist

  • Read the contributions page.
  • Submitted the CLA form (first-time contributor).
  • The introduced changes are covered by tests.

Notes

This change improves test reliability across environments where CoreDNS runs
inside containerd and is not visible as a host process due to snap confinement.

Copy link
Author

@Santa0337 Santa0337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tox -e lint
lint: commands[0]> flake8 --max-line-length=120 --ignore=C901,N801,N802,N803,N806,N816,W503,E203
lint: commands[1]> codespell --ignore-words-list=aks,ccompiler,NotIn --quiet-level=2 '--skip=.patch,.spec,.tox_env,.git,*.nsi'
lint: commands[2]> black --diff --check --exclude '/(.eggs|.git|.tox|.venv|.build|dist|charmhelpers|mod)/' .
All done! ✨ 🍰 ✨
72 files would be left unchanged.
lint: OK (4.21=setup[0.11]+cmd[1.24,0.45,2.40] seconds)
congratulations :) (4.26 seconds)

Copy link
Author

@Santa0337 Santa0337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lazzarello, @ktsakalozos could you make a code review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant